home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 2002 January / PC Answers January 2002.7z / PC Answers January 2002.bin / graphics / freepixl / _SETUP.1 / Printers.pxl < prev    next >
Text File  |  2000-12-23  |  5KB  |  188 lines

  1. {    Filename    :     user1_12.pxl
  2.      Purpose    :    Skeleton file for PiXCL applications
  3.     Date    :    12 may 98
  4.     Author:        S.Dibbs, VYSOR Integration Inc
  5. History:
  6.  
  7.     Version    :  1.0    RELEASE
  8.     Update    :  
  9.     Date    :  
  10.  
  11. --------------------------------------------------------------------------}
  12. Initialize: {only one instance allowed}
  13.     UseCoordinates(PIXEL)
  14.     Title$ = "PiXCL 4.2 and Printers"                                  
  15.     WinExist(Title$,Res)
  16.     If Res = 0 Then Goto One_Instance
  17.     Beep
  18.     WinSetActive(Title$,Res)
  19.     WinShow(Title$,RESTORE,Res)
  20.     End
  21. One_Instance:
  22.     UseCaption(Title$) {change the title}
  23.     WinLocate(Title$,268,130,816,506,Res)                
  24.     UseBackground(TRANSPARENT,255,255,255)     
  25.     WinShow(Title$,NOTOPMOST,Res) 
  26.     DrawBackGround
  27.     DirGet(SourceDir$) {used later for library function calls}
  28.  
  29.     DragAcceptFile(ENABLE,AcceptFile)
  30.     AutoProgressBar(DISABLE)
  31.  
  32.     InfoMenu(REMOVE)
  33.     WaitInput(100)
  34.     SetMenu("&File",IGNORE,
  35.         "&New",CreatingFile,
  36.         "&Open",OpeningFile,
  37.         "&Save",SavingFile,
  38.         SEPARATOR,
  39.         "E&xit!",Terminate,
  40.         ENDPOPUP,
  41.         "&View",IGNORE,
  42.         "&ToolBar",ViewToolBar,
  43.         "&StatusBar",ViewStatusBar,
  44.         ENDPOPUP,
  45.         "&Information",IGNORE,
  46.         "&Concept",Concept,
  47.         "&Help",ShowAppHelp,
  48.         SEPARATOR,
  49.         "&About",About,
  50.         ENDPOPUP)
  51.  
  52.     GoSub MakeToolbar
  53.     ChangeMenuItem("&ToolBar",CHECK,TBRes)
  54.  
  55.         
  56.     StatusWindow(ENABLE,BOTTOM,2,200,-1,0,0)
  57.     DrawStatusWinText(0,"Ready")
  58.     ChangeMenuItem("&StatusBar",CHECK,SBRes)
  59.  
  60.         
  61.  
  62.     
  63. Wait_for_Input:
  64.     WaitInput()
  65.  
  66. Terminate:
  67.     End
  68.  
  69.  
  70. Concept:
  71.     MessageBox(OK,1,INFORMATION,
  72. "This is a skeleton of a PiXCL application.  You could briefly
  73. describe your application's function here, or provide some
  74. basic help information.",
  75.     "PiXCL Skeleton Concept",Res)
  76.  
  77.     Goto Wait_for_Input
  78.  
  79. ShowAppHelp:
  80.     {An application Help file usually has the same name as the application.}
  81.     Winhelp("printers.hlp",CONTENTS,"")
  82.  
  83.     Goto Wait_for_Input
  84.  
  85. About:
  86.     AboutUser("PiXCL 4.2 and Printers",  { or substitute Title$}
  87.       "Two lines of text goes here e.g. Application function.",
  88.     "Four Lines of additional information goes here, perhaps contact information and Web addresses")
  89.  
  90.     Goto Wait_for_Input
  91.  
  92. ViewToolBar:
  93.     GetMenuStatus("&ToolBar",CHECKED,Res)
  94.     If Res = 0
  95.         GoSub MakeToolbar
  96.         ChangeMenuItem("&ToolBar",CHECK,Res)
  97.     Else
  98.         Toolbar()
  99.         ChangeMenuItem("&ToolBar",UNCHECK,Res)
  100.     Endif
  101.     Goto Wait_for_Input
  102.  
  103. ViewStatusBar:
  104.     GetMenuStatus("&StatusBar",CHECKED, Res)
  105.     If Res = 0
  106.         StatusWindow(ENABLE,BOTTOM,2,200,-1,0,0)
  107.         DrawStatusWinText(0,"Ready")
  108.         ChangeMenuItem("&StatusBar",CHECK,Res)
  109.     Else
  110.         StatusWindow(DISABLE,BOTTOM,2,200,-1,0,0)
  111.        ChangeMenuItem("&StatusBar",UNCHECK,Res)
  112.     Endif
  113.     Goto Wait_for_Input
  114.  
  115. CreatingFile:
  116.     {TODO: add file handling here}
  117.     Goto Wait_for_Input
  118.  
  119. OpeningFile:
  120.     DrawBackground
  121.     Chr(10,Delimiter$)
  122.     EnumPrinters(LOCAL,NONSHARED,Name$,ONE,Delimiter$,PrinterNameList$,
  123.     PrinterDescList$,Result)
  124.  
  125.     DrawTextExt(10,30,300,200,PrinterNameList$,LEFT)
  126.     DrawTextExt(10,120,300,200,PrinterDescList$,LEFT)
  127.  
  128.     Goto Wait_for_Input
  129.  
  130. SavingFile:
  131.     DrawBackground
  132.     Chr(10,Delimiter$)
  133.     EnumPrinters(LOCAL,SHARED,Name$,ONE,Delimiter$,PrinterNameList$,
  134.     PrinterDescList$,Result)
  135.  
  136.     DrawTextExt(10,30,300,200,PrinterNameList$,LEFT)
  137.     DrawTextExt(10,120,300,200,PrinterDescList$,LEFT)
  138.     Goto Wait_for_Input
  139.  
  140. PrintingFileSelect:
  141.     WaitInput(1)
  142.     Filter$ = "Image Files(*.bmp),*.bmp"
  143.     Label$ = "Select a bitmap to print"
  144.     InitFile$ = "*.bmp"
  145.     InitDir$ = SourceDir$
  146.     FileGet(Filter$,InitFile$,InitDir$,Label$,CHANGEDIR,ImageFile$)
  147.     If ImageFile$ <> ""
  148.         PrintBitmap(ImageFile$,PRINT_PTRRES,Res)
  149.         If Res = 0 Then DrawStatusWinText(0,"PrintBitmap failed")
  150.     Endif
  151.     Goto Wait_for_Input
  152.  
  153. PrintingFileDefault:
  154.     WaitInput(1)
  155.     Filter$ = "Image Files(*.bmp),*.bmp"
  156.     Label$ = "Select a bitmap to print"
  157.     InitFile$ = "*.bmp"
  158.     InitDir$ = SourceDir$
  159.     FileGet(Filter$,InitFile$,InitDir$,Label$,CHANGEDIR,ImageFile$)
  160.     If ImageFile$ <> ""
  161.         PrintBitmap(ImageFile$,DPRINT_PTRRES,Res)
  162.         If Res = 0 Then DrawStatusWinText(0,"PrintBitmap failed")
  163.     Endif
  164.     Goto Wait_for_Input
  165.  
  166.  
  167. AcceptFile:
  168.     GetDragList(FileList$)
  169.     {TODO: add file list handling here, or delete this whole label handler}
  170.     Goto Wait_for_Input
  171.     
  172.  
  173. {--- Style Suggestion: place all subroutines at the end of the script.}
  174.  
  175. MakeToolbar: {subroutine}
  176.     Toolbar( RAISED, PXL_LARGE,
  177.         NULL, NULL, SEPARATOR, "", Wait_for_Input,
  178.         PXL_NEW, ENABLED, STD, "FileNew", CreatingFile,
  179.         PXL_OPEN, ENABLED, STD, "Non-Shared Printers", OpeningFile,
  180.         PXL_SAVE, ENABLED, STD, "Shared Printers", SavingFile,
  181.         PXL_PRINT,  ENABLED, STD,"Print a Bitmap", PrintingFileSelect,
  182.         NULL, NULL, SEPARATOR, "", Wait_for_Input,
  183.         PXL_PRINT,  ENABLED, STD,"Print a Bitmap on Default Printer", PrintingFileDefault,
  184.         NULL, NULL, SEPARATOR, "", Wait_for_Input,
  185.         PXL_SHOHLP, ENABLED, STD,"Show Help",ShowAppHelp)
  186.  
  187.     Return
  188.